package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        Point p = new Point(1, 2);
        c.add(p); //将p添加到集合c中------------将引用地址装到c集合中
        System.out.println(p); //  (1, 2)
        System.out.println(c); //  [(1, 2)]

        p.setX(3);
        System.out.println(p); //  (3, 2)
        System.out.println(c); //  [(3, 2)]
    }
}
